const path = require("path");
const express = require("express");
const app = express();
const api = require("./router");
const connect = require("./connect");
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

app.use("/api", api);
app.use("/static", express.static("static"));
app.set("view engine", "ejs");
app.set("views", path.join(__dirname, "views"));

// 测试页面
app.get("/login", (req, res) => {
    res.render("login");
});
app.get("/", (req, res) => {
    res.render("index");
});

app.listen(3000, () => {
    console.log("Server is running on port 3000");
});
